#include <tsin/util/FileLogger.hpp>

#include <fstream>

using namespace tsin;

const char DEFAULT_LOGFILE[] = "tsin.log";

FileLogger::FileLogger()
        : fout (DEFAULT_LOGFILE)
{
}

FileLogger::FileLogger(const char *path)
        : fout (path)
{
}

FileLogger::~FileLogger()
{
        fout.close();
}

Logger &FileLogger::operator<<(const int i)
{
        if (current < filter)
                fout << i;
        return *this;
}

Logger &FileLogger::operator<<(const char *str)
{
        if (current < filter)
                fout << str;
        return *this;
}

Logger &FileLogger::operator<<(const float d)
{
        if (current < filter)
                fout << d;
        return *this;
}

